package com.edt.ichannel.api.service.impl;

import cc.edt.iceutils3.date.IceDateFormatUtils;
import com.edt.ichannel.api.common.constant.CommonConstant;
import com.edt.ichannel.api.common.entity.ActionResult;
import com.edt.ichannel.api.dao.OrderCreditCkDao;
import com.edt.ichannel.api.entiy.local.OrderCreditCK;
import com.edt.ichannel.api.service.OrderCreditCKService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;


/**
 * OrderCreditCk服务接口实现类
 * @date 2018-10-24
 */
@Service
public class OrderCreditCkServiceImpl implements OrderCreditCKService {

    @Resource
    private OrderCreditCkDao ordercreditckDao;



    /**
    * 添加保存信息
    *
    * @param ordercreditck 数据信息
    * @return ActionResult
    * @date 2018-10-24
    */
    @Override
    public ActionResult insertOrderCredit(OrderCreditCK ordercreditck) {
        ActionResult actionResult = new ActionResult();

        ordercreditckDao.saveOrderCreditCk(ordercreditck);
        actionResult.setMessage("添加成功。");
        actionResult.setSuccess(CommonConstant.ACTIONRESULT_TRUE);

        return actionResult;
    }

    @Override
    public List<OrderCreditCK> selectNeedPutOut() {
        return ordercreditckDao.selectNeedPutOut();
    }

    @Override
    public void moveOrderCreditCkToOrderCredit() {
        ordercreditckDao.moveOrderCreditCkToOrderCredit();
    }

    @Override
    public void saveOrUpdateOrderCreditCk(OrderCreditCK orderCreditCK) {
        ordercreditckDao.saveOrUpdateOrderCreditCk(orderCreditCK);
    }

    @Override
    public void moveOrderCreditCkToOrderCreditByOrderCode(String orderCode) {
        ordercreditckDao.moveOrderCreditCkToOrderCreditByOrderCode(orderCode);
    }

    @Override
    public List<OrderCreditCK> selectOrderChannelCNeedPush() {

        return ordercreditckDao.selectOrderChannelCNeedPush(IceDateFormatUtils.dateToString(new Date(),"yyyyMM"));
    }

    @Override
    public void updateNeedPushuToOver(String id) {
        ordercreditckDao.updateNeedPushuToOver(id);
    }

    @Override
    public void overFlowMonthCommission(String id) {
        ordercreditckDao.overFlowMonthCommission(id);
    }

    @Override
    public void addCommissionMoney(String id, Double commissionMoney) {
        ordercreditckDao.addCommissionMoney(id,commissionMoney);
    }

    @Override
    public void appendRemark(String id, String s) {
        ordercreditckDao.appendRemark(id,s);
    }

    @Override
    public OrderCreditCK selectOrderCreditCkByOrderCode(String orderCode) {
        return ordercreditckDao.selectOrderCreditCkByOrderCode(orderCode);
    }


}